<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jstl/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:converge="http://com.interactivemediamanagement.converge/tags">
    <ui:composition template="/WEB-INF/facelets/templates/default.xhtml">

        <ui:define name="title">
            <h:outputText value="#{msgs.CONCEPTS}" />
        </ui:define>

        <ui:define name="pageBody">
            <a4j:outputPanel id="ajaxPage">
                <div id="layout2">
                    <div id="leftColumn">
                        <ui:insert name="leftTop" />

                        <h:form id="frmConceptSearch">
                            <converge:moduleHeader moduleTitle="#{msgs.concepts_SEARCH}" />
                            <div class="moduleContent">

                                <h:panelGroup layout="block" style="text-align: center">
                                    <h:inputText id="txtConceptSearch" styleClass="text sideInput"
                                                 value="#{concepts.search}" />
                                </h:panelGroup>

                                <h:panelGrid columns="2" columnClasses="left, right" style="width: 100%">
                                    <h:outputText value="" />
                                    <a4j:commandButton styleClass="button smallButton"
                                                       value="#{msgs.concepts_SEARCH_BUTTON_LABEL}"
                                                       actionListener="#{concepts.onSearch}"
                                                       type="submit"
                                                       reRender="ajaxPage" />
                                </h:panelGrid>

                            </div>
                        </h:form>
                        <div style="clear: both; padding-bottom: 12px;"></div>

                        <h:form id="frmConceptOptions">
                            <converge:moduleHeader moduleTitle="#{msgs.concepts_SHOW}" />
                            <div class="moduleContent">
                                <h:panelGrid columns="2">

                                    <h:panelGroup styleClass="concept_SUB" layout="block">
                                        <h:outputText value="#{msgs['dk.i2m.converge.core.metadata.Subject_SHORT']}" />
                                    </h:panelGroup>

                                    <a4j:commandLink reRender="ajaxPage" actionListener="#{concepts.onShowSubjects}">
                                        <h:outputText value="#{msgs.concepts_SUBJECTS}" />
                                    </a4j:commandLink>

                                    <h:panelGroup styleClass="concept_LOC" layout="block">
                                        <h:outputText value="#{msgs['dk.i2m.converge.core.metadata.GeoArea_SHORT']}" />
                                    </h:panelGroup>

                                    <a4j:commandLink reRender="ajaxPage" actionListener="#{concepts.onShowGeoAreas}">
                                        <h:outputText value="#{msgs.concepts_GEOAREAS}" />
                                    </a4j:commandLink>

                                    <h:panelGroup styleClass="concept_POI" layout="block">
                                        <h:outputText value="#{msgs['dk.i2m.converge.core.metadata.PointOfInterest_SHORT']}" />
                                    </h:panelGroup>

                                    <a4j:commandLink reRender="ajaxPage" actionListener="#{concepts.onShowPoi}">
                                        <h:outputText value="#{msgs.concepts_POINTS_OF_INTEREST}" />
                                    </a4j:commandLink>

                                    <h:panelGroup styleClass="concept_ORG" layout="block">
                                        <h:outputText value="#{msgs['dk.i2m.converge.core.metadata.Organisation_SHORT']}" />
                                    </h:panelGroup>

                                    <a4j:commandLink reRender="ajaxPage" actionListener="#{concepts.onShowOrganisations}">
                                        <h:outputText value="#{msgs.concepts_ORGANISATIONS}" />
                                    </a4j:commandLink>

                                    <h:panelGroup styleClass="concept_PER" layout="block">
                                        <h:outputText value="#{msgs['dk.i2m.converge.core.metadata.Person_SHORT']}"
                                                      styleClass="concept" />
                                    </h:panelGroup>

                                    <a4j:commandLink reRender="ajaxPage" actionListener="#{concepts.onShowPersons}">
                                        <h:outputText value="#{msgs.concepts_PERSONS}" />
                                    </a4j:commandLink>

                                </h:panelGrid>
                            </div>
                        </h:form>


                        <div style="clear: both; padding-bottom: 12px;"></div>


                        <c:if test="#{userSession.privileged['MANAGE_CONCEPTS'] || userSession.privileged['NEW_CONCEPTS']}">
                            <h:form id="frmManageConcepts">
                                <converge:moduleHeader moduleTitle="#{msgs.concepts_MANAGE}" />
                                <div class="moduleContent">
                                    <h:panelGrid columns="2">
                                        <h:graphicImage value="#{res.BULLET_ICON}" />
                                        <a4j:commandLink reRender="frmConceptDetails" actionListener="#{concepts.onNewConcept}">
                                            <h:outputText value="#{msgs.concepts_NEW_CONCEPT}" />
                                            <rich:componentControl for="mpConceptDetails"
                                                                   operation="show"
                                                                   event="oncomplete" />
                                        </a4j:commandLink>

                                        <h:graphicImage value="#{res.BULLET_ICON}" rendered="#{userSession.privileged['MANAGE_CONCEPTS']}" />
                                        <a4j:commandLink reRender="frmImport" actionListener="#{concepts.onPreImport}" rendered="#{userSession.privileged['MANAGE_CONCEPTS']}">
                                            <h:outputText value="#{msgs.concepts_IMPORT_CONCEPTS}" />
                                            <rich:componentControl for="mpImport" operation="show" event="oncomplete" />
                                        </a4j:commandLink>
                                    </h:panelGrid>
                                </div>
                            </h:form>
                            <div style="clear: both; padding-bottom: 12px;"></div>
                        </c:if>


                        <h:form id="frmRecentConcepts">
                            <converge:moduleHeader moduleTitle="#{msgs.concepts_RECENTLY_ADDED}" />
                            <div class="moduleContent">

                                <h:dataTable var="concept" value="#{concepts.mostRecent}">
                                    <h:column>
                                        <c:set var="key" value="#{concept.type}_SHORT" />
                                        <h:panelGroup layout="block" styleClass="concept_#{msgs[key]}">
                                            <h:outputText value="#{msgs[key]}" />
                                        </h:panelGroup>
                                    </h:column>

                                    <h:column>
                                        <a4j:commandLink actionListener="#{concepts.onShowConcept}" reRender="ajaxPage">
                                            <f:setPropertyActionListener value="#{concept}" target="#{concepts.selectedConcept}" />
                                            <h:outputText value="#{concept.name}" />
                                        </a4j:commandLink>
                                    </h:column>
                                </h:dataTable>
                            </div>
                        </h:form>

                        <div style="clear: both; padding-bottom: 12px;"></div>

                        <!--h:form id="frmMostPopularConcepts">
                            <converge:moduleHeader moduleTitle="#{msgs.concepts_MOST_POPULAR}" />
                            <div class="moduleContent">
                                <h:dataTable value ="#{concepts.mostPopular}" var="concept">
                                    <h:column>
                                        <h:graphicImage value="#{res.BULLET_ICON}"
                                                        alt="#{concept.name}"
                                                        title="#{concept.name}" />
                                    </h:column>
                                    <h:column>
                                        <a4j:commandLink reRender="frmConceptDetails" actionListener="#{concepts.onShowConcept}">
                                            <f:setPropertyActionListener target="#{concepts.selectedConcept}" value="#{concept}" />
                                            <h:outputText value="#{concept.name}" />
                                        </a4j:commandLink>
                                    </h:column>
                                </h:dataTable>
                            </div>
                        </h:form-->
                        <ui:insert name="leftBottom" />
                    </div>
                    <div id="rightColumn">
                        <ui:insert name="body" />
                    </div>
                </div>
            </a4j:outputPanel>
        </ui:define>
    </ui:composition>
</html>
